package de.hwrBerlin.dataMining.view.vImage.figures;

import org.dom4j.Element;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;

public abstract class FilledFigure extends Figure {
    
    protected Color _background = null;
    
    
    
    public void setBackground(Color pColor) {
        _background = pColor;
    }
    
    
    
    public Color getBackground() {
        return _background;
    }
    
    
    
    protected void setValuesToGc(GC pGc) {
        super.setValuesToGc(pGc);
        
        if (_background != null) {
            pGc.setBackground(_background);
        }
    }
    
    
    
    protected void setValuesToSVGElement(Element pElement) {
        super.setValuesToSVGElement(pElement);
        String value = pElement.attributeValue("style");

        
        if (_background != null) {
            value += "fill:#" + colorToHex(_background) + ";";
        }
        
        pElement.addAttribute("style", value);
    }
    
}
